is DEPRECATED
ErrorsCollection

is DEPRECATED

Synthesised documentation from type/Routine type/Attribute

From type/Routine

See Original text in context

multi sub trait_mod:<is>(Routine:D $r:$DEPRECATED!)

Marks a Routine as deprecated; that is, it should no longer be used going forward, and will eventually be removed. An optional message specifying the replacement functionality can be specified

By having both the original (deprecated) and new Routine available simultaneously, you can avoid a breaking change in a single release, by allowing users time and instructions on how to update their code. Remove the deprecated version only after at least one release that includes both the warning and the new Routine.

This code

sub f() is DEPRECATED('the literal 42'{ 42 }
say f();

produces this output:

42
Saw 1 occurrence of deprecated code.
================================================================================
Sub f (from GLOBALseen at:
  deprecated.p6line 2
Please use the literal 42 instead.
--------------------------------------------------------------------------------
Please contact the author to have these occurrences of deprecated code
adaptedso that this message will disappear!

From type/Attribute

See Original text in context

multi sub trait_mod:<is>(Attribute:D $r:$DEPRECATED!)

Marks an attribute as deprecated, optionally with a message what to use instead.

class C {
    has $.foo is DEPRECATED("'bar'");
}
my $c = C.newfoo => 42 );  # doesn't trigger with initialization (yet) 
say $c.foo;                  # does trigger on usage

After the program is finished, this will show something like this on STDERR:

# Saw 1 occurrence of deprecated code. 
# ===================================== 
# Method foo (from C) seen at: 
# script.p6, line 5 
# Please use 'bar' instead.